package it.fuzzylogics.fuzzywidgetsLibrary.client.FuzzyListeners;

import com.google.gwt.user.client.Element;


public class FMouseEnterListener {
    public FMouseEnterListener(Element e, FMouseEnterHandler handler) {
        attachMouseEnterHandler(e, handler);
    }

    public static void setMouseEnterEvent(Element e, FMouseEnterHandler handler) {
        new FMouseEnterListener(e, handler);
    }

    private static native void dispatchMouseEnterHendler(FMouseEnterHandler handler) /*-{
            handler.@it.fuzzylogics.fuzzywidgetsLibrary.client.FuzzyListeners.FMouseEnterHandler::onMouseEnter()();
      }-*/;

    private native void attachMouseEnterHandler(Element e, FMouseEnterHandler handler) /*-{

         e.onmouseover = handler;

               if ($wnd.addEventListener && !$wnd.opera) {
                   e.addEventListener('onmouseover', @it.fuzzylogics.fuzzywidgetsLibrary.client.FuzzyListeners.FMouseEnterListener::dispatchMouseEnterHendler(Lit/fuzzylogics/fuzzywidgetsLibrary/client/FuzzyListeners/FMouseEnterHandler;), false);
               }

          e.onmouseover = function() {

                   @it.fuzzylogics.fuzzywidgetsLibrary.client.FuzzyListeners.FMouseEnterListener::dispatchMouseEnterHendler(Lit/fuzzylogics/fuzzywidgetsLibrary/client/FuzzyListeners/FMouseEnterHandler;)(handler);

          }

      }-*/;
}
